package com.smxy.mall.dao;


import com.smxy.mall.entity.Order;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;

public interface OrderDao extends JpaRepository<Order,String>, JpaSpecificationExecutor<Order> {
    List<Order> findByUserId(Integer userId);
    List<Order> findByStatusAndUserId(Integer status, Integer userId);
    Order findById(Integer id);

    // 店铺id，用户id，状态小于status
    Page<Order> findByShopIdAndUserIdAndStatusLessThan(Integer shopId, Integer userId, Integer status, Pageable pageable);

    //用户店铺全部订单
    Page<Order> findByShopIdAndUserId(Integer shopId,Integer userId, Pageable pageable);

    //根据订单状态查询用户店铺订单
    Page<Order> findByShopIdAndUserIdAndStatus(Integer shopId, Integer userId, Integer status, Pageable pageable);
}
